IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'spRequests_Update')
	BEGIN
		PRINT 'Dropping Procedure spRequests_Update'
		DROP  Procedure  spRequests_Update
	END

GO

PRINT 'Creating Procedure spRequests_Update'
GO
Create Procedure dbo.spRequests_Update
	( 	  
		@Request_ID int, 
		@CreatedByUser_ID numeric(9,0) = null, 
		@RequestDate DateTime = null, 
		@RequestStatus varchar(50) = null, 
		@Comments varchar(50) = null, 
		@ApprovedByUser_ID numeric(9,0) = null, 
		@ApprovedDate DateTime = null, 
		@OpenByUser_ID numeric(9,0) = null, 
		@OpenDate DateTime = null, 
		@ClosedByUser_ID numeric(9,0) = null, 
		@ClosedDate DateTime = null, 
		@DepartmentName varchar(50) = null, 
		@DivisionName varchar(50) = null
	)
AS
  /* 
    ------------------------------------------------------------------------------
    - Change History
    - --------------
    - Date          Description
    ------------------------------------------------------------------------------
    - 2007/11/02    Initial version Updated
    ------------------------------------------------------------------------------
  */

	-- Declare the required variables

	-- Update the required new record
	UPDATE Requests
	SET
		CreatedByUser_ID = @CreatedByUser_ID, 
		RequestDate = @RequestDate, 
		RequestStatus = @RequestStatus, 
		Comments = @Comments, 
		ApprovedByUser_ID = @ApprovedByUser_ID, 
		ApprovedDate = @ApprovedDate, 
		OpenByUser_ID = @OpenByUser_ID, 
		OpenDate = @OpenDate, 
		ClosedByUser_ID = @ClosedByUser_ID, 
		ClosedDate = @ClosedDate, 
		DepartmentName = @DepartmentName, 
		DivisionName = @DivisionName		
	WHERE Request_ID = @Request_ID

	-- Return to calling method
	RETURN
	
GO
